<template>
  <div class="Reg_body">
    <div>
      <input
        class="Reg_text"
        type="text"
        placeHolder="账户名/手机号/Email"
        v-model="un"
      />
    </div>
    <div>
      <input
        class="Reg_text"
        type="password"
        placeHolder="请输入您的密码"
        v-model="pw"
      />
    </div>
    <div class="Reg_btn">
      <input type="submit" value="注册" @click="regAccount" />
    </div>
    <div class="Reg_link">
      <router-link to="/mine/login" tag="a">返回登录</router-link>
    </div>
  </div>
</template>

<script>
export default {
  name: "Reg",
  data() {
    return {
      un: "",
      pw: "",
    };
  },
  methods: {
    async regAccount() {
      let data = await this.$axios.post("/users/regist", {
        username: this.un,
        password: this.pw,
      });
      if (data.code === 0) {
        this.$router.push("/users/login");
      }
      return false;
    },
  },
};
</script>

<style scoped>
#content .Reg_body {
  width: 100%;
}
.Reg_body .Reg_text {
  width: 100%;
  height: 40px;
  border: none;
  border-bottom: 1px #ccc solid;
  margin-bottom: 5px;
  outline: none;
  text-indent: 10px;
}
.Reg_body .Reg_btn {
  height: 50px;
  margin: 10px;
}
.Reg_body .Reg_btn input {
  width: 100%;
  height: 100%;
  background: #e54847;
  border-radius: 3px;
  border: none;
  display: block;
  color: white;
  font-size: 20px;
}
.Reg_body .Reg_link {
  display: flex;
  justify-content: space-between;
}
.Reg_body .Reg_link a {
  text-decoration: none;
  margin: 0 5px;
  font-size: 12px;
  color: #e54847;
}
</style>